//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.gui.fixed;

import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class AddressViewer extends JPanel {

    public AddressViewer() {
        compagnyJLabel = null;
        statusJLabel = null;
        addrLn1JLabel = null;
        addrLn2JLabel = null;
        zipJLabel = null;
        cityJLabel = null;
        initialize();
    }

    private void initialize() {
        setLayout(null);
        setSize(300, 97);
        add(getCompagnyJLabel(), null);
        add(getStatusJLabel(), null);
        add(getAddrLn1JLabel(), null);
        add(getAddrLn2JLabel(), null);
        add(getZipJLabel(), null);
        add(getCityJLabel(), null);
    }

    private JLabel getCompagnyJLabel() {
        if (compagnyJLabel == null) {
            compagnyJLabel = new JLabel();
            compagnyJLabel.setText("Compagny");
            compagnyJLabel.setSize(200, 20);
            compagnyJLabel.setLocation(5, 5);
            compagnyJLabel.setFont(new Font("MS Sans Serif", 1, 12));
        }
        return compagnyJLabel;
    }

    private JLabel getStatusJLabel() {
        if (statusJLabel == null) {
            statusJLabel = new JLabel();
            statusJLabel.setText("Status");
            statusJLabel.setSize(85, 20);
            statusJLabel.setLocation(210, 5);
        }
        return statusJLabel;
    }

    private JLabel getAddrLn1JLabel() {
        if (addrLn1JLabel == null) {
            addrLn1JLabel = new JLabel();
            addrLn1JLabel.setText("Address line 1");
            addrLn1JLabel.setSize(290, 20);
            addrLn1JLabel.setLocation(5, 27);
        }
        return addrLn1JLabel;
    }

    private JLabel getAddrLn2JLabel() {
        if (addrLn2JLabel == null) {
            addrLn2JLabel = new JLabel();
            addrLn2JLabel.setText("Address line 2");
            addrLn2JLabel.setSize(290, 20);
            addrLn2JLabel.setLocation(5, 49);
        }
        return addrLn2JLabel;
    }

    private JLabel getZipJLabel() {
        if (zipJLabel == null) {
            zipJLabel = new JLabel();
            zipJLabel.setText("ZIP");
            zipJLabel.setSize(50, 20);
            zipJLabel.setLocation(5, 71);
        }
        return zipJLabel;
    }

    private JLabel getCityJLabel() {
        if (cityJLabel == null) {
            cityJLabel = new JLabel();
            cityJLabel.setText("City");
            cityJLabel.setSize(235, 20);
            cityJLabel.setLocation(60, 71);
        }
        return cityJLabel;
    }

    public void setCompagnyLabel(String txt) {
        getCompagnyJLabel().setText(txt);
    }

    public String getCompagnyLabel() {
        return getCompagnyJLabel().getText();
    }

    public void setStatusLabel(String txt) {
        getStatusJLabel().setText(txt);
    }

    public String getStatusLabel() {
        return getStatusJLabel().getText();
    }

    public void setAddrLn1Label(String txt) {
        getAddrLn1JLabel().setText(txt);
    }

    public String getAddrLn1Label() {
        return getAddrLn1JLabel().getText();
    }

    public void setAddrLn2Label(String txt) {
        getAddrLn2JLabel().setText(txt);
    }

    public String getAddrLn2Label() {
        return getAddrLn2JLabel().getText();
    }

    public void setZipLabel(String txt) {
        getZipJLabel().setText(txt);
    }

    public String getZipLabel() {
        return getZipJLabel().getText();
    }

    public void setCityLabel(String txt) {
        getCityJLabel().setText(txt);
    }

    public String getCityLabel() {
        return getCityJLabel().getText();
    }

    public void clean() {
        setCityLabel("");
        setZipLabel("");
        setAddrLn2Label("");
        setAddrLn1Label("");
        setStatusLabel("");
        setCompagnyLabel("");
    }
    private JLabel compagnyJLabel;
    private JLabel statusJLabel;
    private JLabel addrLn1JLabel;
    private JLabel addrLn2JLabel;
    private JLabel zipJLabel;
    private JLabel cityJLabel;
}
